package svl;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Colecciones
 */
@WebServlet("/Colecciones")
public class Colecciones extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Colecciones() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	    String[] nombres = { "Rodrigo", "Gimena", "Alvaro" };
	    List<String> apellidos = new ArrayList<String>();
	    apellidos.add("Rodriguez");
	    apellidos.add("Gimenez");
	    apellidos.add("Alvarez");
	    Map<String,String> companias = new HashMap<String,String>();
	    companias.put("Gimenez", "Gimenez y Hnos");
	    companias.put("Alvarez", "Alvarez S.R.L.");
	    companias.put("Rodriguez", "Rodriguez S.A.");
	    request.setAttribute("nombre", nombres); 
	    request.setAttribute("apellido", apellidos);
	    request.setAttribute("compania", companias);
	    RequestDispatcher dispatcher = request.getRequestDispatcher("WEB-INF/jsp/colecciones.jsp");
	    dispatcher.forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
